###########
echo "aria2"
if [[ `cat /etc/*-release|grep alpine` ]];then
which aria2c || apk add aria2 && nohup aria2c --enable-rpc --rpc-listen-all &
which git || apk add git -y
which node || apk add node
[ -e aria2 ] || git clone https://ghproxy.com/https://github.com/ziahamza/webui-aria2.git aria2
cd aria2 && ps -ef |grep node-server.js|grep -v grep || nohup node node-server.js &

elif [[ `cat /etc/*-release|grep -E 'ubuntu[^ ]*|debian[^ ]*'` ]];then 
which aria2c || apt install aria2 -y
nohup aria2c --enable-rpc --rpc-listen-all &
which git || apt install git -y
which node || apt install nodejs-legacy
[ -e aria2 ] || git clone https://ghproxy.com/https://github.com/ziahamza/webui-aria2.git aria2
cd aria2 && ps -ef |grep node-server.js|grep -v grep || nohup node node-server.js &

elif [[ `cat /etc/*-release|grep -E 'centos[^ ]*|fedora[^ ]*'` ]];then 
which aria2c || wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 
#which aria2c || rpm -ivh epel-release-latest-7.noarch.rpm
#which aria2c || yum install aria2
#aria2c --enable-rpc --rpc-listen-all|grep '地址已在使用'
#pkill aria2
bash <(curl -ls https://gitee.com/ewf-9/BiJi/raw/master/aria2.sh)
#nohup aria2c --enable-rpc --rpc-listen-all &
which git || yum install git -y
which node || bash <(curl -ls https://gitee.com/ewf-9/BiJi/raw/master/nodejs.sh)
yum install nodejs -y
[ -e aria2 ] || git clone https://ghproxy.com/https://github.com/ziahamza/webui-aria2.git aria2
cd aria2 && ps -ef |grep node-server.js|grep -v grep || nohup node node-server.js &
iptables -I INPUT -p 6 --dport 8888 -j ACCEPT
iptables -I INPUT -p 6 --dport 8888 -j ACCEPT
fi
echo 'http://ip:8888' 
#w="which";
#ac="nohup aria2c --enable-rpc --rpc-listen-all &"
#g="git clone https://ghproxy.com/https://github.com/ziahamza/webui-aria2.git aria2 && cd aria2 && node node-server.js"
#pe="ps -ef |grep node-server.js|grep -v grep"